﻿using System;
using System.ComponentModel;
using System.Reflection;
using System.Runtime.InteropServices;

namespace Teigha.Core
{
	public class OdGiDrawableOverrule : OdRxOverrule
	{
		[EditorBrowsable(EditorBrowsableState.Never)]
		public OdGiDrawableOverrule(IntPtr cPtr, bool cMemoryOwn) : base(GlobalsPINVOKE.OdGiDrawableOverrule_SWIGUpcast(cPtr), cMemoryOwn)
		{
			this.swigCPtr = new HandleRef(this, cPtr);
		}

		[EditorBrowsable(EditorBrowsableState.Never)]
		public static HandleRef getCPtr(OdGiDrawableOverrule obj)
		{
			if (obj != null)
			{
				return obj.swigCPtr;
			}
			return new HandleRef(null, IntPtr.Zero);
		}

		~OdGiDrawableOverrule()
		{
			this.Dispose();
		}

		public override void Dispose()
		{
			if (this.swigCPtr.Handle != IntPtr.Zero)
			{
				if (this.swigCMemOwn)
				{
					lock (this.locker)
					{
						if (this.swigCPtr.Handle != IntPtr.Zero && this.swigCMemOwn)
						{
							this.swigCMemOwn = false;
							GlobalsPINVOKE.delete_OdGiDrawableOverrule(this.swigCPtr);
						}
					}
					this.swigCMemOwn = false;
				}
				this.swigCPtr = new HandleRef(null, IntPtr.Zero);
			}
			GC.SuppressFinalize(this);
			base.Dispose();
		}

		public OdGiDrawableOverrule() : this(GlobalsPINVOKE.new_OdGiDrawableOverrule(), MemoryManager.GetMemoryManager().GetCurrentTransaction() == null)
		{
			MemoryTransaction currentTransaction = MemoryManager.GetMemoryManager().GetCurrentTransaction();
			if (currentTransaction != null)
			{
				currentTransaction.AddObject(new OdGiDrawableOverrule(this.swigCPtr.Handle, true));
			}
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			this.SwigDirectorConnect();
		}

		public new static OdGiDrawableOverrule cast(OdRxObject pObj)
		{
			MemoryManager memoryManager = MemoryManager.GetMemoryManager();
			MemoryTransaction currentTransaction = memoryManager.GetCurrentTransaction();
			IntPtr p = GlobalsPINVOKE.OdGiDrawableOverrule_cast(OdRxObject.getCPtr(pObj));
			OdGiDrawableOverrule result;
			if (currentTransaction != null)
			{
				currentTransaction.AddObject((OdGiDrawableOverrule)Teigha.Core.Helpers.odrxCreateObjectInternal(p, true));
				result = (OdGiDrawableOverrule)Teigha.Core.Helpers.odrxCreateObjectInternal(p, false);
			}
			else
			{
				result = (OdGiDrawableOverrule)Teigha.Core.Helpers.odrxCreateObjectInternal(p, true);
			}
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public new static OdRxClass desc()
		{
			OdRxClass result = (OdRxClass)Teigha.Core.Helpers.odrxCreateObjectInternal(GlobalsPINVOKE.OdGiDrawableOverrule_desc(), false);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public new virtual OdRxClass isA()
		{
			OdRxClass result = (OdRxClass)Teigha.Core.Helpers.odrxCreateObjectInternal(this.SwigDerivedClassHasMethod("isA", OdGiDrawableOverrule.swigMethodTypes1) ? GlobalsPINVOKE.OdGiDrawableOverrule_isASwigExplicitOdGiDrawableOverrule(this.swigCPtr) : GlobalsPINVOKE.OdGiDrawableOverrule_isA(this.swigCPtr), false);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public new virtual OdRxObject queryX(OdRxClass protocolClass)
		{
			OdRxObject result = Teigha.Core.Helpers.odrxCreateObjectInternal(this.SwigDerivedClassHasMethod("queryX", OdGiDrawableOverrule.swigMethodTypes0) ? GlobalsPINVOKE.OdGiDrawableOverrule_queryXSwigExplicitOdGiDrawableOverrule(this.swigCPtr, OdRxClass.getCPtr(protocolClass)) : GlobalsPINVOKE.OdGiDrawableOverrule_queryX(this.swigCPtr, OdRxClass.getCPtr(protocolClass)), false);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public new static OdGiDrawableOverrule createObject()
		{
			MemoryManager memoryManager = MemoryManager.GetMemoryManager();
			MemoryTransaction currentTransaction = memoryManager.GetCurrentTransaction();
			IntPtr p = GlobalsPINVOKE.OdGiDrawableOverrule_createObject();
			OdGiDrawableOverrule result;
			if (currentTransaction != null)
			{
				currentTransaction.AddObject((OdGiDrawableOverrule)Teigha.Core.Helpers.odrxCreateObjectInternal(p, true));
				result = (OdGiDrawableOverrule)Teigha.Core.Helpers.odrxCreateObjectInternal(p, false);
			}
			else
			{
				result = (OdGiDrawableOverrule)Teigha.Core.Helpers.odrxCreateObjectInternal(p, true);
			}
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual uint setAttributes(OdGiDrawable pSubject, OdGiDrawableTraits traits)
		{
			uint result = this.SwigDerivedClassHasMethod("setAttributes", OdGiDrawableOverrule.swigMethodTypes3) ? GlobalsPINVOKE.OdGiDrawableOverrule_setAttributesSwigExplicitOdGiDrawableOverrule(this.swigCPtr, OdGiDrawable.getCPtr(pSubject), OdGiDrawableTraits.getCPtr(traits)) : GlobalsPINVOKE.OdGiDrawableOverrule_setAttributes(this.swigCPtr, OdGiDrawable.getCPtr(pSubject), OdGiDrawableTraits.getCPtr(traits));
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual bool worldDraw(OdGiDrawable pSubject, OdGiWorldDraw wd)
		{
			bool result = this.SwigDerivedClassHasMethod("worldDraw", OdGiDrawableOverrule.swigMethodTypes4) ? GlobalsPINVOKE.OdGiDrawableOverrule_worldDrawSwigExplicitOdGiDrawableOverrule(this.swigCPtr, OdGiDrawable.getCPtr(pSubject), OdGiWorldDraw.getCPtr(wd)) : GlobalsPINVOKE.OdGiDrawableOverrule_worldDraw(this.swigCPtr, OdGiDrawable.getCPtr(pSubject), OdGiWorldDraw.getCPtr(wd));
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual void viewportDraw(OdGiDrawable pSubject, OdGiViewportDraw vd)
		{
			if (this.SwigDerivedClassHasMethod("viewportDraw", OdGiDrawableOverrule.swigMethodTypes5))
			{
				GlobalsPINVOKE.OdGiDrawableOverrule_viewportDrawSwigExplicitOdGiDrawableOverrule(this.swigCPtr, OdGiDrawable.getCPtr(pSubject), OdGiViewportDraw.getCPtr(vd));
			}
			else
			{
				GlobalsPINVOKE.OdGiDrawableOverrule_viewportDraw(this.swigCPtr, OdGiDrawable.getCPtr(pSubject), OdGiViewportDraw.getCPtr(vd));
			}
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual uint viewportDrawLogicalFlags(OdGiDrawable pSubject, OdGiViewportDraw vd)
		{
			uint result = this.SwigDerivedClassHasMethod("viewportDrawLogicalFlags", OdGiDrawableOverrule.swigMethodTypes6) ? GlobalsPINVOKE.OdGiDrawableOverrule_viewportDrawLogicalFlagsSwigExplicitOdGiDrawableOverrule(this.swigCPtr, OdGiDrawable.getCPtr(pSubject), OdGiViewportDraw.getCPtr(vd)) : GlobalsPINVOKE.OdGiDrawableOverrule_viewportDrawLogicalFlags(this.swigCPtr, OdGiDrawable.getCPtr(pSubject), OdGiViewportDraw.getCPtr(vd));
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual uint regenSupportFlags(OdGiDrawable pSubject)
		{
			uint result = this.SwigDerivedClassHasMethod("regenSupportFlags", OdGiDrawableOverrule.swigMethodTypes7) ? GlobalsPINVOKE.OdGiDrawableOverrule_regenSupportFlagsSwigExplicitOdGiDrawableOverrule(this.swigCPtr, OdGiDrawable.getCPtr(pSubject)) : GlobalsPINVOKE.OdGiDrawableOverrule_regenSupportFlags(this.swigCPtr, OdGiDrawable.getCPtr(pSubject));
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		private void SwigDirectorConnect()
		{
			if (this.SwigDerivedClassHasMethod("queryX", OdGiDrawableOverrule.swigMethodTypes0))
			{
				this.swigDelegate0 = new OdGiDrawableOverrule.SwigDelegateOdGiDrawableOverrule_0(this.SwigDirectorqueryX);
			}
			if (this.SwigDerivedClassHasMethod("isA", OdGiDrawableOverrule.swigMethodTypes1))
			{
				this.swigDelegate1 = new OdGiDrawableOverrule.SwigDelegateOdGiDrawableOverrule_1(this.SwigDirectorisA);
			}
			if (this.SwigDerivedClassHasMethod("isApplicable", OdGiDrawableOverrule.swigMethodTypes2))
			{
				this.swigDelegate2 = new OdGiDrawableOverrule.SwigDelegateOdGiDrawableOverrule_2(this.SwigDirectorisApplicable);
			}
			if (this.SwigDerivedClassHasMethod("setAttributes", OdGiDrawableOverrule.swigMethodTypes3))
			{
				this.swigDelegate3 = new OdGiDrawableOverrule.SwigDelegateOdGiDrawableOverrule_3(this.SwigDirectorsetAttributes);
			}
			if (this.SwigDerivedClassHasMethod("worldDraw", OdGiDrawableOverrule.swigMethodTypes4))
			{
				this.swigDelegate4 = new OdGiDrawableOverrule.SwigDelegateOdGiDrawableOverrule_4(this.SwigDirectorworldDraw);
			}
			if (this.SwigDerivedClassHasMethod("viewportDraw", OdGiDrawableOverrule.swigMethodTypes5))
			{
				this.swigDelegate5 = new OdGiDrawableOverrule.SwigDelegateOdGiDrawableOverrule_5(this.SwigDirectorviewportDraw);
			}
			if (this.SwigDerivedClassHasMethod("viewportDrawLogicalFlags", OdGiDrawableOverrule.swigMethodTypes6))
			{
				this.swigDelegate6 = new OdGiDrawableOverrule.SwigDelegateOdGiDrawableOverrule_6(this.SwigDirectorviewportDrawLogicalFlags);
			}
			if (this.SwigDerivedClassHasMethod("regenSupportFlags", OdGiDrawableOverrule.swigMethodTypes7))
			{
				this.swigDelegate7 = new OdGiDrawableOverrule.SwigDelegateOdGiDrawableOverrule_7(this.SwigDirectorregenSupportFlags);
			}
			GlobalsPINVOKE.OdGiDrawableOverrule_director_connect(this.swigCPtr, this.swigDelegate0, this.swigDelegate1, this.swigDelegate2, this.swigDelegate3, this.swigDelegate4, this.swigDelegate5, this.swigDelegate6, this.swigDelegate7);
		}

		private bool SwigDerivedClassHasMethod(string methodName, Type[] methodTypes)
		{
			MethodInfo method = base.GetType().GetMethod(methodName, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic, null, methodTypes, null);
			return method.DeclaringType.IsSubclassOf(typeof(OdGiDrawableOverrule));
		}

		private IntPtr SwigDirectorqueryX(IntPtr protocolClass)
		{
			return OdRxObject.getCPtr(this.queryX((OdRxClass)Teigha.Core.Helpers.odrxCreateObjectInternal(protocolClass, false))).Handle;
		}

		private IntPtr SwigDirectorisA()
		{
			return OdRxClass.getCPtr(this.isA()).Handle;
		}

		private bool SwigDirectorisApplicable(IntPtr pOverruledSubject)
		{
			return this.isApplicable(Teigha.Core.Helpers.odrxCreateObjectInternal(pOverruledSubject, false));
		}

		private uint SwigDirectorsetAttributes(IntPtr pSubject, IntPtr traits)
		{
			return this.setAttributes((OdGiDrawable)Teigha.Core.Helpers.odrxCreateObjectInternal(pSubject, false), new OdGiDrawableTraits(traits, false));
		}

		private bool SwigDirectorworldDraw(IntPtr pSubject, IntPtr wd)
		{
			return this.worldDraw((OdGiDrawable)Teigha.Core.Helpers.odrxCreateObjectInternal(pSubject, false), new OdGiWorldDraw_Internal(wd, false));
		}

		private void SwigDirectorviewportDraw(IntPtr pSubject, IntPtr vd)
		{
			this.viewportDraw((OdGiDrawable)Teigha.Core.Helpers.odrxCreateObjectInternal(pSubject, false), new OdGiViewportDraw_Internal(vd, false));
		}

		private uint SwigDirectorviewportDrawLogicalFlags(IntPtr pSubject, IntPtr vd)
		{
			return this.viewportDrawLogicalFlags((OdGiDrawable)Teigha.Core.Helpers.odrxCreateObjectInternal(pSubject, false), new OdGiViewportDraw_Internal(vd, false));
		}

		private uint SwigDirectorregenSupportFlags(IntPtr pSubject)
		{
			return this.regenSupportFlags((OdGiDrawable)Teigha.Core.Helpers.odrxCreateObjectInternal(pSubject, false));
		}

		private object locker = new object();

		private HandleRef swigCPtr;

		private OdGiDrawableOverrule.SwigDelegateOdGiDrawableOverrule_0 swigDelegate0;

		private OdGiDrawableOverrule.SwigDelegateOdGiDrawableOverrule_1 swigDelegate1;

		private OdGiDrawableOverrule.SwigDelegateOdGiDrawableOverrule_2 swigDelegate2;

		private OdGiDrawableOverrule.SwigDelegateOdGiDrawableOverrule_3 swigDelegate3;

		private OdGiDrawableOverrule.SwigDelegateOdGiDrawableOverrule_4 swigDelegate4;

		private OdGiDrawableOverrule.SwigDelegateOdGiDrawableOverrule_5 swigDelegate5;

		private OdGiDrawableOverrule.SwigDelegateOdGiDrawableOverrule_6 swigDelegate6;

		private OdGiDrawableOverrule.SwigDelegateOdGiDrawableOverrule_7 swigDelegate7;

		private static Type[] swigMethodTypes0 = new Type[]
		{
			typeof(OdRxClass)
		};

		private static Type[] swigMethodTypes1 = new Type[0];

		private static Type[] swigMethodTypes2 = new Type[]
		{
			typeof(OdRxObject)
		};

		private static Type[] swigMethodTypes3 = new Type[]
		{
			typeof(OdGiDrawable),
			typeof(OdGiDrawableTraits)
		};

		private static Type[] swigMethodTypes4 = new Type[]
		{
			typeof(OdGiDrawable),
			typeof(OdGiWorldDraw)
		};

		private static Type[] swigMethodTypes5 = new Type[]
		{
			typeof(OdGiDrawable),
			typeof(OdGiViewportDraw)
		};

		private static Type[] swigMethodTypes6 = new Type[]
		{
			typeof(OdGiDrawable),
			typeof(OdGiViewportDraw)
		};

		private static Type[] swigMethodTypes7 = new Type[]
		{
			typeof(OdGiDrawable)
		};

		public delegate IntPtr SwigDelegateOdGiDrawableOverrule_0(IntPtr protocolClass);

		public delegate IntPtr SwigDelegateOdGiDrawableOverrule_1();

		public delegate bool SwigDelegateOdGiDrawableOverrule_2(IntPtr pOverruledSubject);

		public delegate uint SwigDelegateOdGiDrawableOverrule_3(IntPtr pSubject, IntPtr traits);

		public delegate bool SwigDelegateOdGiDrawableOverrule_4(IntPtr pSubject, IntPtr wd);

		public delegate void SwigDelegateOdGiDrawableOverrule_5(IntPtr pSubject, IntPtr vd);

		public delegate uint SwigDelegateOdGiDrawableOverrule_6(IntPtr pSubject, IntPtr vd);

		public delegate uint SwigDelegateOdGiDrawableOverrule_7(IntPtr pSubject);
	}
}
